﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HustQQModel;

namespace HustQQInterface
{
    public class InterfaceManager
    {
        public static INetInterface NetManager=new DefaultNetInterface();
        public static IDataInterface DataManager=new DefaultDataInterface();
        public static void RegisterNetInterface(INetInterface i)
        {
            NetManager = i;
        }
        public static void RegisterDataInterface(IDataInterface i)
        {
            DataManager = i;
        }
    }
    public class DefaultNetInterface:INetInterface
    {
        #region INetInterface 成员

        public void SendTextToSingle(string myId, string friendId, string text)
        {
            
        }

        public void SendTextToTeam(string myId, string teamId, string text)
        {
            
        }

        public event SingleTextMsg RecieveTextFromSingle;

        public event TeamTextMsg RecieveTextFromTeam;

        public void SendPictureToSingle(string myId, string friendId, string picPath)
        {
            
        }

        public void SendPictureToTeam(string myId, string teamId, string picPath)
        {
            
        }

        public event SinglePicMsg RecievePicFromSingle;

        public event TeamPicMsg RecievePicFromTeam;

        public void SendFile(string myId, string friendId, string filePath)
        {
            
        }

        public event FileMsg RecieveFile;

        public bool Login(string userId, string pwd)
        {
            return true;
        }

        public string Register(HustQQModel.User u)
        {
            return "123";
        }

        public HustQQModel.User GetUserInformation(string userId, bool isDetail)
        {
            return new User();
        }

        public bool AddFriendToUser(string myId, string friendId,string groupName)
        {
            return true;
        }

        public bool AddFriendToGroup(string myId, string friendId, string groupName)
        {
            return true;
        }

        public bool DelFriendFromUser(string myId, string friendId)
        {
            return true;
        }

        public bool DelFriendFromGroup(string myId, string friendId, string groupName)
        {
            return true;
        }

        public bool SetUserInformation(HustQQModel.User u)
        {
            return true;
        }

        public string NewTeamToUser(string myId)
        {
            return "111";
        }

        public HustQQModel.Team GetTeamInformation(string teamId, bool isDetail)
        {
            return new Team();
        }

        public bool SetTeamInformation(HustQQModel.Team t)
        {
            return true;
        }

        public bool AddFriendToTeam(string teamId, string userId)
        {
            return true;
        }

        public bool DelFriendFromTeam(string teamId, string userId)
        {
            return true;
        }

        public bool SetIpPort(string userId, HustQQModel.IpPort ipPort)
        {
            return true;
        }

        public HustQQModel.IpPort GetIpPort(string userId)
        {
            return new IpPort("127.0.0.1","20000");
        }

        #endregion

        #region INetInterface 成员


        public event FileMsg ConfirmRecieveFile;

        public event BooleanMsg ConfirmSendFile;

        public event Action SendFileOver;

        public event FileMsg ReceiveFileOver;

        #endregion

        #region INetInterface 成员


        public void ReplyConfirm(bool isOk)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region INetInterface 成员


        public User GetMyself(string userId)
        {
            throw new NotImplementedException();
        }

        public User FindFriend(string userId, string findUerId)
        {
            throw new NotImplementedException();
        }

        public Team FindTeam(string userId, string teamId)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region INetInterface 成员


        public List<User> GetFriend(string userId)
        {
            throw new NotImplementedException();
        }

        public List<Team> GetGroup(string userId)
        {
            throw new NotImplementedException();
        }

        public List<User> GetTeamMember(string userId, string teamId)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region INetInterface 成员


        public bool Logout(string userId)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
    public class DefaultDataInterface:IDataInterface
    {
        #region IDataInterface 成员

        public bool Login(string userId, string pwd)
        {
            return true;
        }

        public string Register(HustQQModel.User u)
        {
            return "123";
        }

        public HustQQModel.User GetUserInformation(string userId, bool isDetail)
        {
            return new User();
        }

        public bool AddFriendToUser(string myId, string friendId)
        {
            return true;
        }

        public bool AddFriendToGroup(string myId, string friendId, string groupName)
        {
            return true;
        }

        public bool DelFriendFromUser(string myId, string friendId)
        {
            return true;
        }

        public bool DelFriendFromGroup(string myId, string friendId, string groupName)
        {
            return true;
        }

        public bool SetUserInformation(HustQQModel.User u)
        {
            return true;
        }

        public string NewTeamToUser(string myId, string teamName)
        {
            return "111";
        }

        public HustQQModel.Team GetTeamInformation(string teamId, bool isDetail)
        {
            return new Team();
        }

        public bool SetTeamInformation(HustQQModel.Team t)
        {
            return true;
        }

        public bool AddFriendToTeam(string teamId, string userId)
        {
            return true;
        }

        public bool DelFriendFromTeam(string teamId, string userId)
        {
            return true;
        }

        public bool SetIpPort(string userId, HustQQModel.IpPort ipPort)
        {
            return true;
        }

        public HustQQModel.IpPort GetIpPort(string userId)
        {
            return new IpPort("127.0.0.1", "20000");
        }

        public List<string> GetTeams(string myId)
        {
            return null;
        }

        #endregion
    }
}
